import axios from 'axios'
export function request(option){
    //创建axios实例
    const instance = axios.create({
        baseURL:'http://127.0.0.1:8888/api/admin_sys/',
        timeout:5000
        // ,headers:{
        //     'Content-Type':'application/x-www-form-urlencoded'
        // }
    });
    // axios拦截器
    instance.interceptors.request.use(config=>{
        console.log(config)
        return config;
    },err => {
        console.log(err)
    });
    instance.interceptors.response.use(res=>{
        console.log(res)
        return res.data;
    },err => {
        console.log(err)
    });
    //返回的就是个Promise对象
    return instance(option);
}